package com.pj.wisdomlogistics.ui.activity;

import android.view.View;
import android.widget.CheckBox;

import com.pj.wisdomlogistics.R;
import com.pj.wisdomlogistics.cons.Cons;
import com.pj.wisdomlogistics.other.EventCenter;
import com.pj.wisdomlogistics.utils.ActivityManagerUtil;

import org.greenrobot.eventbus.EventBus;

import butterknife.BindView;
import butterknife.OnClick;

public class ChooseRoomActivity extends BaseActivity {

    @BindView(R.id.cb1)
    CheckBox mCb1;
    @BindView(R.id.cb2)
    CheckBox mCb2;
    @BindView(R.id.cb3)
    CheckBox mCb3;

    @Override
    public void initView() {

    }

    @Override
    public void initData() {

    }

    @Override
    public int getContentView() {
        return R.layout.activity_choose_room;
    }

    @Override
    public boolean isApplyEventBus() {
        return false;
    }

    @Override
    public boolean isApplyButterKnife() {
        return true;
    }

    @Override
    public void onEventCome(EventCenter eventCenter) {

    }



    @OnClick({R.id.iv_back, R.id.tv_sure , R.id.cb1 , R.id.cb2 , R.id.cb3})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                ActivityManagerUtil.create().finishActivity();
                break;
            case R.id.tv_sure:
                EventBus.getDefault().post(new EventCenter<>(Cons.MealInfo.ROOM ,
                        mCb1.isChecked() ? "201" : mCb2.isChecked() ? "202" : "203"));
                ActivityManagerUtil.create().finishActivity();
                break;
            case R.id.cb1:
                mCb1.setChecked(true);
                mCb2.setChecked(false);
                mCb3.setChecked(false);
                break;
            case R.id.cb2:
                mCb1.setChecked(false);
                mCb2.setChecked(true);
                mCb3.setChecked(false);
                break;
            case R.id.cb3:
                mCb1.setChecked(false);
                mCb2.setChecked(false);
                mCb3.setChecked(true);
                break;
        }
    }
}
